<template>
  <div>
    <van-swipe :height="175" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item,index) in swipeList" :key="index">
        <img :src="item.image_src" alt />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>
<script>
export default {
  data() {
    return {
      swipeList: []
    };
  },
  methods: {
    async getSwipeList() {
      const { data: res } = await this.$http("/home/swiperdata");
      //   console.log(res);
      if (res.meta.status !== 200) {
        this.$toast.fail("获取数据失败！");
      }
      this.swipeList = res.message;
    }
  },
  created() {
    this.getSwipeList();
  }
};
</script>

<style lang="less" scoped>
.van-swipe {
  .van-swipe-item {
    img {
      width: 100%;
    }
  }
}
</style>